from tinyshop.common.tinyshop_login import Tinyshop_Login
class Change_wd:
    def __init__(self):
        self.driver=Tinyshop_Login().login('123@qq.com','654321')
    #创建修改密码动作函数
    def pw_change(self,pay_pwd,new_pwd):
        self.driver.find_element_by_xpath('/html/body/div[1]/div[1]/div/div[2]/ul/li[1]/a').click()
        self.driver.find_element_by_xpath('/html/body/div[2]/div/div[1]/div/div/ul[3]/li[2]/a').click()
        self.driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/table/tbody/tr[1]/td[3]/a').click()
        self.driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div[2]/form/ul/li[1]/input').send_keys(pay_pwd)
        self.driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div[2]/form/ul/li[3]/input').click()
        self.driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div[2]/form/ul/li[1]/input').send_keys(new_pwd)
        self.driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div[2]/form/ul/li[2]/input').send_keys(new_pwd)
        self.driver.find_element_by_xpath('/html/body/div[3]/div/div[2]/div[2]/form/ul/li[4]/input').click()

    #创建修改密码成功断言
    def assert_succ_change_pwd(self,expect):
        if expect in self.driver.find_element_by_xpath('/html/body/div[2]/div/div[2]/div[2]/div/span').text:
            print('pass')
        else:
            print('fail')
        self.driver.quit()

    def test(self):
        pass

